package com.ctshk.sapp.system.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.rpc.system.dto.MainDataGroupComprehensiveCostDTO;
import com.ctshk.rpc.system.req.MainDataGroupComprehensiveCostAddReq;
import com.ctshk.rpc.system.req.MainDataGroupComprehensiveCostIdReq;
import com.ctshk.rpc.system.req.MainDataGroupComprehensiveCostListReq;
import com.ctshk.rpc.system.req.MainDataGroupComprehensiveCostUpdateReq;
import com.ctshk.rpc.system.service.IMainDataGroupComprehensiveCostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;

/**
 * <p>
 * 团综合成本项 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-03-11
 */
@Api(value = "团综合成本项",tags = "团综合成本项")
@RestController
@RequestMapping("/main/data/group/comprehensive/cost")
public class MainDataGroupComprehensiveCostController extends BaseController {


    @DubboReference
    private IMainDataGroupComprehensiveCostService mainDataGroupComprehensiveCostService;


    @ApiOperation(value = "新增团综合成本项", notes = "新增团综合成本项")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.ADD, operTitle = "新增团综合成本项", operDesc = "新增团综合成本项")
    @PostMapping("/add")
    public Result add(@RequestBody @Valid MainDataGroupComprehensiveCostAddReq req) {
        return mainDataGroupComprehensiveCostService.add(req, getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "查询团综合成本项", notes = "查询团综合成本项")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.QUERY, operTitle = "查询团综合成本项", operDesc = "查询团综合成本项")
    @PostMapping("/query")
    public Result<MainDataGroupComprehensiveCostDTO> query(@RequestBody @Valid MainDataGroupComprehensiveCostIdReq req) {
        return Result.success(mainDataGroupComprehensiveCostService.query(req));
    }

    @ApiOperation(value = "编辑团综合成本项", notes = "编辑团综合成本项")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.QUERY, operTitle = "编辑团综合成本项", operDesc = "编辑团综合成本项")
    @PostMapping("/update")
    public Result update(@RequestBody @Valid MainDataGroupComprehensiveCostUpdateReq req) {
        return mainDataGroupComprehensiveCostService.update(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "查询团综合成本项列表", notes = "查询团综合成本项列表")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.QUERY, operTitle = "查询团综合成本项列表", operDesc = "查询团综合成本项列表")
    @PostMapping("/list")
    public Result<PageResponse<MainDataGroupComprehensiveCostDTO>> list(@RequestBody @Valid MainDataGroupComprehensiveCostListReq req) {
        return Result.success(mainDataGroupComprehensiveCostService.List(req));
    }
}
